/*
 * @Author: 李世千
 * @Date: 2021-04-21 15:50:43
 * @LastEditTime: 2021-04-26 16:33:12
 * @LastEditors: 李世千
 */
import { MessageBoard,GetDetail, MessageTransfer,getMsgboard} from "@/seivers/page";
import { makeAutoObservable } from "mobx"
import {RootObject,DetailObject} from '@/utils/page'
class Page{

    constructor(){
        makeAutoObservable(this);
    } 
       msgboardList: any = {};
   Leave:RootObject[] = []
    detailist:DetailObject[]=[]

    page = 1;
    total = 0;

    async  getMsgboard(){
        let result = await getMsgboard();
        if (result.statusCode === 200) {
          this.msgboardList = result.data;
          
        }
    }

    // 留言板
    async  MessageBoard(Id:any,page:number){
        let result = await MessageBoard(Id, page);
        if(result.statusCode===200){
            this.Leave=result.data[0];
            this.total = result.data[1];
            page++
        }
    }

    async  GetDetail(id:string){
        let result = await  GetDetail(id);
        console.log(result)
        if(result.statusCode===200){
            this.Leave=result.data
 
        }
    }
  
    async  MessageTransfer(data:any){
        console.log(data);
        
        let result = await  MessageTransfer(data);
        console.log(result)
        // console.log(result)
        // if(result.statusCode===200){
        //     this.leave=result.data
 
        // }
    }
}

export default Page;